<template>
	<view class="action-card" @click="handleClick">
		<view class="card-icon" :style="{ backgroundColor: iconBgColor }">
			<u-icon :name="iconName" size="48" :color="iconColor"></u-icon>
		</view>
		<view class="card-content">
			<text class="card-title">{{ title }}</text>
			<text class="card-desc">{{ description }}</text>
		</view>
		<view class="card-arrow">
			<u-icon name="arrow-right" color="#909399" size="24"></u-icon>
		</view>
	</view>
</template>

<script>
export default {
	name: 'ActionCard',
	props: {
		title: {
			type: String,
			default: '操作标题'
		},
		description: {
			type: String,
			default: '操作描述'
		},
		iconName: {
			type: String,
			default: 'setting'
		},
		iconColor: {
			type: String,
			default: '#2979ff'
		},
		iconBgColor: {
			type: String,
			default: 'rgba(41, 121, 255, 0.1)'
		}
	},
	methods: {
		handleClick() {
			this.$emit('click');
		}
	}
}
</script>

<style lang="scss">
.action-card {
	background-color: #ffffff;
	border-radius: 16rpx;
	padding: 40rpx 20rpx;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
	transition: all 0.3s;
	min-height: 200rpx;
	text-align: center;
}

.action-card:active {
	transform: scale(0.98);
	opacity: 0.9;
}

.card-icon {
	margin-bottom: 20rpx;
	padding: 20rpx;
	border-radius: 50%;
	display: flex;
	justify-content: center;
	align-items: center;
}

.card-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.card-title {
	font-size: 28rpx;
	font-weight: 500;
	color: #303133;
	margin-bottom: 10rpx;
	display: block;
	text-align: center;
}

.card-desc {
	font-size: 24rpx;
	color: #909399;
	display: block;
	text-align: center;
	line-height: 1.4;
}

.card-arrow {
	display: none;
}
</style> 